-
Notifications
You must be signed in to change notification settings - Fork 39
Add WDT Library #242
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add WDT Library #242
Conversation
Create keywords.txt
Bringing up to date with release1.1.2
I hate to undo even a little bit of Adam's good work, but in the interests of a robust core, I think it's best the references to time.h are removed, and the Epoch set/get along with it. RTC.cpp included <time.h>, which caused a compilation error when these are also included in code: #include <Time.h> #include <TimeLib.h> Some possible issues with Window lack of case sensitivity, refer here: https://forum.arduino.cc/index.php?topic=451360.0 Also with time.h (or Time.h?) being an optional extra install library to the Arduino IDE, best to leave it out of the core, especially if it can cause compilation errors.
This reverts commit ece522d.
this keeps room around for the legacy BLE led example
A quick note that the failed checks are due to: Is this perhaps due to using |
libraries/WDT/examples/Example3_WDT_LowPower/Example3_WDT_LowPower.ino
Outdated
Show resolved
Hide resolved
libraries/WDT/examples/Example2_WDT_Config/Example2_WDT_Config.ino
Outdated
Show resolved
Hide resolved
libraries/WDT/examples/Example2_WDT_Config/Example2_WDT_Config.ino
Outdated
Show resolved
Hide resolved
libraries/WDT/examples/Example2_WDT_Config/Example2_WDT_Config.ino
Outdated
Show resolved
Hide resolved
So yes, I've been through and commented, I thought that was just on the files, but it's made a whole lot of comments on the main conversations - any Github tips? Basically - excellent work, I only had suggestions for:
|
Added simplied defintions and error checking to setClock() and configure(). More detailed comments.
Thanks @stephenf7072! I believe I've addressed all of your comments in 38a241b. Also, please see your individual comments for more detailed information of specific issues. Cheers, |
Nice one Adam. I've been over the new bits and apart from the minor omission of a "HZ" in keywords, no further comments from me. |
Hi @adamgarbo and @stephenf7072 Thanks for all your effort! You both probably know that we are in the midst of a big transition to the v2.0.0 core. That being said I think this PR should be merged into v2.0.0 rather than trying to squeeze it in on the tail end of v1.x.x This PR is not forgotten! |
Thanks @oclyke Is there a way to redirect which branch this PR will merge with? Please let me know if there's anything I can (or should) do. Also, would you like me to create a new RTC library PR for v2.0.0 with the new time variable order (i.e. hund, sec, min, hour, etc.)? Cheers, |
@adamgarbo I have already put the RTC library w/ the order changes into the v2.0.0 branch (took the liberty to do so cause I didn't want to bug anyone for help with it)
Edit: actually I think you need to change the target branch. Should be fairly simple / intuitive.... lmk if you have trouble |
@oclyke Well, that was easy! Updated base branch to v2.0.0. I assumed that was the correct one, and not the preview? |
Yup! There is a sort of rolling release going on like this:
By the way - there will be a decent amount of work to do to make this compatible with |
Thanks, Owen. Is there any documentation on the new file structure and philosophy? Keen to learn more and happy to make changes as necessary. Cheers, |
A quick glance at the new diffs makes me think..... it would probably be easiest to start from scratch based on the v2.0.0 branch. You could of course make a local copy of the meat + potatoes files of your PR. |
Wow - you're quick. Didn't see your last request for docs. I don't have anything official to hand you. Maybe you will be able to tell just by looking at the file structure. Also possible that you won't be affected if you are just writing a library. Here are some notes:
There's probably a lot more - that's all for now though |
@adamgarbo - we've decided to do another support release on the v1.x core, so I will test this out and try to pull it in. That way we can have a reference for what we should be doing on the v2.0.0 version |
Hi @oclyke, Sounds good! Please let me know if you need any assistance or clarification. I haven't yet had a chance to rewrite the WDT library, but if the v2.0.0 RTC library is any example, it shouldn't be too much work. I noticed some of the changes you mentioned (e.g. I'll try to submit a PR to v.2.0.0 in the next couple of days. What's your optimistic timeframe for its release? Cheers, |
@adamgarbo I just tried out these examples. First of all (I hope I have said this before) thanks for the great work! Your examples are well laid out and straight to the point. The first example worked well. I then went on to test examples 2 and 3, but saw no output. Stumped, I went back to example 1 (basic) and saw no output any more. Moving on I even went to an unrelated example (pure serial) I still saw no output. I haven't looked into it any deeper (using a debugger, for example) but can you confirm that you do not have similar issues? |
Hi Owen, I initially tested all examples on a SparkFun Artemis Redboard. I just now tested them on an Edge 2 and they all appeared to be working correctly. Please see below for their respective outputs: Example 1
Example 2
Example 3
I could have sworn we fixed that issue with the Artemis going to sleep and waking up without producing a question mark in the serial output. @nseidle did we only fix this on the OpenLog Artemis? Cheers, |
Thanks - I will look more closely at my setup to see if something is going wrong. I also thought we had fixed the UART startup issue. If I recall correctly it had to do with configuring the UART pins after the UART was initialized... |
Alright, I think I found the issue and it is totally unrelated to this library. It is described in issue #254 I don't believe this is at all related to this PR, and it doesn't occur with the SVL loader either (hence why most people are unlikely to experience the issue) |
Hi @oclyke,
After our recent discussions regarding #237 by @stephenf7072 , I was motivated to get the ball rolling with writing a WDT library the Apollo3 Core. I started working with the WDT HAL earlier this year, and have been meaning put a library together for some time.
Library summary:
For the most part, this library is simply a wrapper of the Ambiq HAL. As we know, the HAL can be scary, so the watchdog functions can now be called using basic commands such as
start
,stop
,restart
, etc.Where I needed to bypass the HAL and switch to writing registers directly was with the watchdog configuration functionality. Normally, when configuring the WDT with the HAL, you need to create a specific
am_hal_wdt_config_t
structure, specify your clock divider and tick values and then pass this structure to the HAL functionam_hal_wdt_init
, which actually does the configuration. Rather than dealing with structures, addresses and pointers, I opted to write a few of simple functions (e.g.configure()
,setClock()
,setInterrupt()
,setReset()
, to have greater overall control of these registers.Default configuration: There is a globally declared
am_hal_wdt_config_t watchdogConfig
structure in the header file, which is used for the initial WDT configuration. This defaults the LFRC clock divider to 16 Hz, the interrupt period to 4 seconds and reset period to 8 seconds. For users of either Atmega328p or SAMD21 watchdogs, these periods will be familiar, though are ultimately arbitrarily and able to be changed.All examples tested with a SparkFun Redboard Artemis. A test program (not included) was also run to iterate the WDT through every clock divider, interrupt and reset tick combination to ensure correct timings.
My hope is that other users will identify additional required functionality or make contributions themselves. I welcome your feedback!
Cheers,
Adam
Examples:
1. Example1_WDT_Basic
2. Example2_WDT_Config
3. Example3_WDT_LowPower